package com.sikaryofficial.backend.controller;

import com.sikaryofficial.backend.manager.ProductStaticsManager;
import com.sikaryofficial.common.core.domain.R;
import com.sikaryofficial.common.core.web.controller.BaseController;
import com.sikaryofficial.system.api.model.product.ProductStatisticsReq;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 品牌口味Controller
 *
 * @author qinjinyuan
 * @date 2023-11-07
 */
@RestController
@RequestMapping("/product/statics")
@Api(tags = "产品数据统计")
@Slf4j
@RefreshScope
public class ProductStaticsController extends BaseController {
    @Autowired
    private ProductStaticsManager productStaticsManager;

    /**
     * 汇总更新统计 某产品 所有的扫码次数
     *
     * @return
     */
    @PostMapping("/normalSave")
    @ApiOperation("产品统计数据保存")
    public R<Boolean> saveData(@Validated @RequestBody ProductStatisticsReq req) {
        return R.ok(productStaticsManager.saveData(req));
    }
}